<jsp:include page="includes/header.jsp" />

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<c:set var="webContext" value="${pageContext.request.contextPath}"  />
<spring:message code="register.form.input.name" var="PLACEHOLDER_NOMBRE" />
<spring:message code="register.form.input.lastName" var="PLACEHOLDER_APELLIDO" />
<spring:message code="register.form.input.email" var="PLACEHOLDER_EMAIL" />
<spring:message code="register.form.input.userName" var="PLACEHOLDER_USUARIO" />
<spring:message code="register.form.input.password" var="PLACEHOLDER_PASSWORD" />
<spring:message code="register.form.input.confirmPassword" var="PLACEHOLDER_CONFIRM_PASSWORD" />
<spring:message code="register.form.button.register" var="BOTON_REGISTRO" />

  <section class="title">
    <div class="container">
      <div class="row-fluid">
        <div class="span6">
          <h1>Registro</h1>
        </div>
        <div class="span6">
          <ul class="breadcrumb pull-right">
            <li><a href="${webContext}/">Home</a> <span class="divider">/</span></li>
            <li class="active">Registrate</li>
          </ul>
        </div>
      </div>
    </div>
  </section>
  <!-- / .title -->       


  <section id="registration-page" class="container">
    <form class="center" id="resgisterForm" action='${webContext}/usuario/registro' method="POST">
      
      <c:if test="${respuesta != null}">
	      <c:if test="${respuesta.message != null}">
	      	<div class="alert alert-success" role="alert">
	      		${respuesta.message}
	      	</div>
	      </c:if>
	      <c:if test="${not empty respuesta.errors }">
	      	<div class="alert alert-danger" role="alert">
	      		<c:forEach items="${respuesta.errors}" var="error">
	      			${error}
	      		</c:forEach>
	      	</div>
	      </c:if>
      </c:if>
      
      <c:if test="${hasErrors != null}">
      	<div class="alert alert-danger" role="alert">
      		<form:errors path="user.*" />
      	</div>
      </c:if>
      
      <fieldset class="registration-form">      	
      	
        <div class="control-group">
         <!-- Nombre -->
         <div class="controls">
            <input type="text" id="nombre" name="nombre" placeholder="${PLACEHOLDER_NOMBRE}" value="${user.nombre}" class="input-xlarge">
          </div>
        </div>
        
        <div class="control-group">
        <!-- Apellido -->
         <div class="controls">
            <input type="text" id="apellido" name="apellido" placeholder="${PLACEHOLDER_APELLIDO}" value="${user.apellido}" class="input-xlarge">
          </div>
        </div>
        
        <div class="control-group">
          <!-- E-mail -->
          <div class="controls">
            <input type="text" id="email" name="email" placeholder="${PLACEHOLDER_EMAIL}" value="${user.email}" class="input-xlarge">
          </div>
        </div>
        
         <div class="control-group">
          <!-- Usuario -->
          <div class="controls">
            <input type="text" id="usuario" name="usuario" placeholder="${PLACEHOLDER_USUARIO}" value="${user.usuario}" class="input-xlarge">
          </div>
        </div>

        <div class="control-group">
          <!-- Password-->
          <div class="controls">
            <input type="password" id="password" name="password" placeholder="${PLACEHOLDER_PASSWORD}" class="input-xlarge">
          </div>
        </div>

        <div class="control-group">
          <!-- Confirm Password -->
          <div class="controls">
            <input type="password" id="password_confirm" name="password_confirm" placeholder="${PLACEHOLDER_CONFIRM_PASSWORD}" class="input-xlarge">
          </div>
        </div>

        <div class="control-group">
          <!-- Button -->
          <div class="controls">
            <button type="button" id="submitRegister" class="btn btn-success btn-large btn-block">${BOTON_REGISTRO}</button>
          </div>
        </div>
      </fieldset>
    </form>
  </section>
  <!-- /#registration-page -->

<jsp:include page="includes/footer.jsp" />